package com.blog.service.impl;

import javax.annotation.Resource;

import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.blog.dao.BloggerDao;
import com.blog.entity.Blogger;
import com.blog.service.BloggerService;

@Service("bloggerService")
@Transactional
public class BloggerServiceImpl implements BloggerService {
	
	@Resource
	private BloggerDao bloggerDao;
	
	@Override
	public Blogger getByUserName(String userName) {
		// TODO Auto-generated method stub
		return bloggerDao.getByUserName(userName);
	}

	@Override
	public Blogger find() {
		// TODO Auto-generated method stub
		return bloggerDao.find();
	}

	@Override
	public Integer update(Blogger paramBlogger) {
		// TODO Auto-generated method stub
		SecurityUtils.getSubject().getSession().setAttribute("currentUser", paramBlogger);
		return bloggerDao.update(paramBlogger);
	}

}
